<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript">
			function login() {
				var xmlhttp;
				if(window.XMLHttpRequest) {
					xmlhttp = new XMLHttpRequest();
				} else {
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				}
				xmlhttp.onreadystatechange = function() {
					if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
						alert(xmlhttp.responseText);

					}

				}
				var phone = 18408248050;
				var pwd = '123456';
				var json_request = '{ "UserPhone":"' + phone + '" , "UserPassword":"' + pwd + '" }';
				xmlhttp.open("POST", "user.php", true);
				xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
				xmlhttp.send("Login=" + json_request);
			}

			function register() {
				var xmlhttp;
				if(window.XMLHttpRequest) {
					xmlhttp = new XMLHttpRequest();
				} else {
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				}
				xmlhttp.onreadystatechange = function() {
					if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
						alert(xmlhttp.responseText);

					}

				}
				var userphone = '18408248054';
				var userpwd = '1234567987';
				var username = '测试输入D';
				var usergender = 1;
				var useremail = '4981121567@qq.com';
				var json_request = '{ "UserPhone":"' + userphone + '" , "UserPassword":"' + userpwd + '" , "UserName":"' + username + '" , "UserGender":"' + usergender + '" , "UserEmail":"' + useremail + '" }';
				xmlhttp.open("POST", "user.php", true);
				xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
				xmlhttp.send("Register=" + json_request);
			}
			function logout(){
				var xmlhttp;
				if(window.XMLHttpRequest) {
					xmlhttp = new XMLHttpRequest();
				} else {
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				}
				xmlhttp.onreadystatechange = function() {
					if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
						location.reload();
					}
				}
				xmlhttp.open("POST", "user.php", true);
				xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
				xmlhttp.send("Action=LogOut");
			}
		</script>
	</head>

	<body>

		<button onclick="register();">注册</button>

	</body>

</html>